import { createRouter, createWebHistory } from 'vue-router'
import Home from '@/views/home/home.vue'
import Aa from '@/views/home/aa.vue'
import Ab from '@/views/home/ab.vue'
import Ac from '@/views/home/ac.vue'
import Ad from '@/views/home/ad.vue'
import Ss from '@/views/ss.vue'

const router = createRouter({
  history: createWebHistory(import.meta.env.BASE_URL),
  routes: [
    { path: '/', redirect: '/home/aa' },
    {path: '/ss',
      name: 'ss',
      component: Ss,},
    {
      path: '/home',
      name: 'home',
      component: Home,
      children:[
        {path: 'aa',component: Aa,},
        {path: 'ab',component: Ab,},
        {path: 'ac',component: Ac,},
        {path: 'ad',component: Ad,},
      ]
    },
    
  ],
})
// router.beforeEach((to, from, next) => {
//   if (to.fullPath == '/home/ab' || to.fullPath == '/home/ac'){
//     let token=localStorage.getItem('token')
//     if(!token){
//         next('/home/ad')
//     }
//   } 
//   next()
// })
export default router
